Object.extend( UWA.Environment.prototype, {

  initialize: function() {
    this.google = {};
  },

  /**
   * Return the variable value from the Environnement
   *
   * @public
   * @param {name}
   * @return mix
   */   
  getData: function(name) {
    if (this.prefs) {
      var value = this.prefs.getString(name);
      if (value == undefined || value == null || value == '' ) return undefined;
      return value;
    } 
    if (window.Cookie) return Cookie.get(name);
  },
  
  /**
   * Set the variable in the Environnement
   *
   * @public
   * @param {name}
   * @param {value}
   * @return void
   */   
  setData: function(name, value) {
    if (this.prefs) return this.prefs.set(name, value);
    if (window.Cookie) return Cookie.set(name, value);
  },
  
  /* to document */
  onUpdateBody: function() {
    this.setDelayed('handleLinks', this.handleLinks, 100);
    this.setDelayed('handleResize', this.handleResize, 100);
  },
  
  /* to document */
  handleResize: function() {
    if (window._IG_AdjustIFrameHeight) _IG_AdjustIFrameHeight();
  },
  
  /* to document */
  setTitle: function(title) {
    title = title.stripTags();
    if (window._IG_SetTitle) _IG_SetTitle(title);
  }

} );

var Environment = new UWA.Environment('google');

if (window._IG_Prefs) Environment.prefs = new _IG_Prefs();

var widget = Environment.getModule();

window.onresize = function() {
  widget.callback('onResize');
}

Environment.setDelayed('updateBody', Environment.onUpdateBody, 1000);